package com.example.account.tcc;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

import java.math.BigDecimal;

@LocalTCC
public interface AccountTccAction {
    /**
     * 为了避开seata bug，不使用order对象封装
     * @param context
     * @return
     */
    @TwoPhaseBusinessAction(name = "AccountTccAction")
    boolean prepare(BusinessActionContext context,
                    @BusinessActionContextParameter(paramName = "userId") Long userId,//属性注入上下文对象
                    @BusinessActionContextParameter(paramName = "money") BigDecimal money);
    boolean commit(BusinessActionContext context);
    boolean rollback(BusinessActionContext context);
}
